package cn.iocoder.an.module.mold.dal.mysql.drawingno;

import java.util.*;

import cn.iocoder.an.framework.common.pojo.PageResult;
import cn.iocoder.an.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.an.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.an.module.mold.dal.dataobject.drawingno.DrawingNoDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.an.module.mold.controller.admin.drawingno.vo.*;

/**
 * 模具图号 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface DrawingNoMapper extends BaseMapperX<DrawingNoDO> {

    default PageResult<DrawingNoDO> selectPage(DrawingNoPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DrawingNoDO>()
                .likeIfPresent(DrawingNoDO::getDrawingNo, reqVO.getDrawingNo())
                .likeIfPresent(DrawingNoDO::getCustomer, reqVO.getCustomer())
                .eqIfPresent(DrawingNoDO::getCategoryId, reqVO.getCategoryId())
                .eqIfPresent(DrawingNoDO::getUpkeepId, reqVO.getUpkeepId())
                .eqIfPresent(DrawingNoDO::getRecheckId, reqVO.getRecheckId())
                .eqIfPresent(DrawingNoDO::getLifeDeductionId, reqVO.getLifeDeductionId())
                .eqIfPresent(DrawingNoDO::getInventoryStatus, reqVO.getInventoryStatus())
                .eqIfPresent(DrawingNoDO::getStorageId, reqVO.getStorageId())
                .eqIfPresent(DrawingNoDO::getDevId, reqVO.getDevId())
                .eqIfPresent(DrawingNoDO::getWarehouseInPersonId, reqVO.getWarehouseInPersonId())
                .betweenIfPresent(DrawingNoDO::getWarehouseInTime, reqVO.getWarehouseInTime())
                .eqIfPresent(DrawingNoDO::getWarehouseOutPersonId, reqVO.getWarehouseOutPersonId())
                .betweenIfPresent(DrawingNoDO::getWarehouseOutTime, reqVO.getWarehouseOutTime())
                .eqIfPresent(DrawingNoDO::getDescription, reqVO.getDescription())
                .betweenIfPresent(DrawingNoDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DrawingNoDO::getId));
    }

    /**
     * 根据图号模糊查询模具图号列表
     *
     * @param drawingNo 图号（模糊匹配）
     * @return 模具图号列表
     */
    List<DrawingNoDO> selectListByDrawingNoLike(String drawingNo);


}